package com.example.business.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
import com.example.business.entity.SysVideoPlayRecord;
import com.example.business.mapper.SysVideoPlayRecordMapper;
import com.example.business.service.SysVideoPlayRecordService;
import org.springframework.cache.annotation.*;
import java.io.Serializable;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.cache.annotation.CacheConfig;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author xiong
 * @since 2024-01-28
 */
@Service
@Transactional
@CacheConfig(cacheNames = "SysVideoPlayRecordServiceImpl")
public class SysVideoPlayRecordServiceImpl extends ServiceImpl<SysVideoPlayRecordMapper, SysVideoPlayRecord> implements SysVideoPlayRecordService {

    @Cacheable(cacheNames = "sysvideoplayrecord",key = "#id")
    @Override
    public SysVideoPlayRecord getById(Serializable id){
        return super.getById(id);
    }

    @CacheEvict(cacheNames = "sysvideoplayrecord", key = "#id")
    @Override
    public boolean removeById(Serializable id) {
        return super.removeById(id);
    }

    @CacheEvict(cacheNames = "sysvideoplayrecord", key = "#sysvideoplayrecord.id")
    @Override
    public boolean updateById(SysVideoPlayRecord sysvideoplayrecord) {
        return super.updateById(sysvideoplayrecord);
    }

    @CachePut(cacheNames = "sysvideoplayrecord", key = "#sysvideoplayrecord.id")
    public SysVideoPlayRecord saveSysVideoPlayRecord(SysVideoPlayRecord sysvideoplayrecord){
        super.save(sysvideoplayrecord);
        return sysvideoplayrecord;
    }

    @CacheEvict(cacheNames = "sysvideoplayrecord", key = "#sysvideoplayrecord.id")
    public SysVideoPlayRecord updateSysVideoPlayRecordById(SysVideoPlayRecord sysvideoplayrecord){
        super.updateById(sysvideoplayrecord);
        return sysvideoplayrecord;
    }
}
